#pragma strict

var spaceShip1Selected = false;
var spaceShip2Selected = false;

var cameraPosition:Transform;
var spaceshipPosition:Transform;
var shadow :GameObject;
var white :GameObject;

var isMine = false;




function OnGUI()
{
   
    if(GUI.Button(Rect(650,200,400,500),"Shadown"))
    {
       Debug.Log("selecionado Shadown");
       networkView.RPC("removeSpaceship",RPCMode.All,"shadown");
       Destroy(this.gameObject);
    }
    
    if(GUI.Button(Rect(100,200,400,500),"White"))
    {
       Debug.Log("selecionado White");
       networkView.RPC("removeSpaceship",RPCMode.All,"white");
       Destroy(this.gameObject);
    }
    
}

@RPC
function removeSpaceship(spaceship:String){
	
	if(spaceship.Equals("shadown")){
		Network.Instantiate(shadow,spaceshipPosition.transform.position, spaceshipPosition.transform.rotation,0);
	}else{
		Network.Instantiate(white,spaceshipPosition.transform.position, spaceshipPosition.transform.rotation,0);
	}
}


@RPC
function setUpSelected( selected : int){
	if(selected ==1)
		spaceShip1Selected = true;
	else
		spaceShip2Selected = true;
		
	if(spaceShip2Selected && spaceShip1Selected){
		Destroy(this.gameObject);
	
	}
}


function Start () {

}

function Update () {

}